
#include "cTypes.h"

#ifdef __cplusplus
extern "C" {
#endif

#define	 GetBit(BL, Pos) ( (BL[(Pos)>>3] >> ((Pos) & 7)) & 1 )
#define  SetBit(BL, Pos) ( BL[(Pos)>>3] |= 1<<((Pos) & 7) ) 
#define  XorBit(BL, Pos) ( BL[(Pos)>>3] ^= 1<<((Pos) & 7) ) 
#define  ClrBit(BL, Pos) ( BL[(Pos)>>3] &= (1<<((Pos) & 7)) ^ 0xFF ) 
#define  Min_(A,B) ( ((A)<=(B))?  (A) : (B) ) 
#define  Max_(A,B) ( ((A)>=(B))?  (A) : (B) ) 

#define	UBoundCNL 255


void Init_CNL_Table();

int  BitLine_PackLength(int N, int L);

int  GetCounter1(int Io, BYTE *BL, int L);

void PutNumber(int N, int MaxN, BYTE *Pool, int *Start);
int  GetNumber(int MaxN, BYTE *Pool, int *Start);


void PutNumber_Tab(int N, int Tab, BYTE *Pool, int *Start);		
int  GetNumber_Tab(int Tab, BYTE *Pool, int *Start);


void Pack_IncDensity_BitLine(int Io, BYTE *BL, BYTE *Pool, int *Start, int Cnt1, int L);
void Unpack_IncDensity_BitLine(int Io, BYTE *BL, BYTE *Pool, int *Start, int Cnt1, int L);

void Pack_Bit_Line(int Io, BYTE *BL, BYTE *Pool, int *Start, int N, int L);
void Unpack_Bit_Line(int Io, BYTE *BL, BYTE *Pool, int *Start, int N, int L);


#ifdef _MMX_
void INTEL_Unpack_Bit_Line_255(int Io, BYTE *BitL, BYTE *Pool, int *Start, int N, int L);  
#endif

#ifdef __cplusplus
}
#endif
